{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}
{% import "_my_wtf_macros.html" as my_wtf_macros %}

{% block title %}万屏时代OPC--联通虚拟号码池{% endblock %}

{% block panel_heading %}
  万屏时代OPC--联通虚拟号码池
    <div class="btn-group pull-right">
        <a href="{{ url_for('axb_bp.import_number_lt') }}" class="btn btn-info btn-sm">导入联通虚拟号</a>
    </div>
{% endblock %}

{% block panel_body %}

    <form id="search-number-lt-form"
          action="{{ url_for('axb_bp.number_list_lt') }}"
          method="post" class="form" role="form">
        {{ my_wtf_macros.form_field(form.tel, div_col=4, label_col=4, field_col=7) }}
        <div class="btn-group">
            <span>
                <button type="submit" class="btn btn-info"
                        id="query-user-btn">
                根据号码查询
            </button>
            </span>
        </div>
    </form>

    <div class="clearfix visible-xs-block visible-sm-block visible-md-block visible-lg-block"></div>

    <form id="number-lt-area-valid-form"
          action="{{ url_for('axb_bp.number_lt_area_valid') }}"
          method="post" class="form" role="form">
        {{ my_wtf_macros.form_field(area_toogle_form.area_id, div_col=4, label_col=4, field_col=7) }}
        <div class="btn-group">
            <span>
                <button type="submit" class="btn btn-success"
                        id="number-lt-area-valid-btn">
                按照地区启用
            </button>
            </span>
        </div>
    </form>

    <div class="clearfix visible-xs-block visible-sm-block visible-md-block visible-lg-block"></div>

    <form id="number-lt-area-invalid-form"
          action="{{ url_for('axb_bp.number_lt_area_invalid') }}"
          method="post" class="form" role="form">
        {{ my_wtf_macros.form_field(area_toogle_form.area_id, div_col=4, label_col=4, field_col=7) }}
        <div class="btn-group">
            <span>
                <button type="submit" class="btn btn-danger"
                        id="number-lt-area-invalid-btn">
                按照地区禁用
            </button>
            </span>
        </div>
    </form>

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'axb_bp.number_list_lt', **url_kwargs) }}
    </div>
    {% endif %}

    <table id="cancel-attention-user-info-table" class="table table-bordered table-hover table-condensed table-striped">
        <thead>
            <tr>
                <th>号码</th>
                <th>省市</th>
                <th>当前使用企业</th>
                <th>是否只用于发短信</th>
                <th>使用次数</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for i in items %}
            <tr>
                <td>{{ i.tel }}</td>
                <td>{{ i.area.name }}</td>
                <td>{{ i.enterprise_name }}</td>
                <td>{{ i.for_sms }}</td>
                <td>{{ i.use_count }}</td>
                <td>
                    {% if i.deleted_at == 0 %}
                        <a href="{{ url_for('axb_bp.number_lt_toggle', tel=i.tel) }}"
                           class="btn btn-danger btn-xs" onclick="return confirm('确定要禁用该虚拟号吗?')"
                        >禁用</a>
                    {% else %}
                        <a href="{{ url_for('axb_bp.number_lt_toggle', tel=i.tel) }}"
                           class="btn btn-success btn-xs" onclick="return confirm('确定要启用该虚拟号吗?')"
                        >启用</a>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    {% if pagination %}
    <div class="pagination">
        {{ macros.pagination_widget(pagination, 'axb_bp.number_list_lt', **url_kwargs) }}
    </div>
    {% endif %}

{% endblock %}

{% block scripts %}
{{ super() }}
{% endblock %}

